{% load wagtailimages_tags wagtailadmin_tags %}
{% load i18n %}
{% if images %}
    {% if is_searching %}
        <h2>
        {% blocktrans count counter=images.paginator.count %}
            There is {{ counter }} match
        {% plural %}
            There are {{ counter }} matches
        {% endblocktrans %}
        </h2>

        {% search_other %}
    {% else %}
        <h2>{% trans "Latest images" %}</h2>
    {% endif %}
<a class="button bicolor icon icon-edit edit-button multi visuallyhidden" data-url="{% url 'multi_image_edit' %}?" href="{% url 'multi_image_edit' %}?">Edit images</a>
    <ul class="listing horiz images multi-image-edit">
        {% for image in images %}
            <li id=image-row-{{ image.id }}>
                <a class="image-choice" title="{% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}" href="{% url 'wagtailimages:edit' image.id %}">
                    <figure>
                        {% include "wagtailimages/images/results_image.html" %}
                        {% trans "pixels" as translated_pixels %}
                        <figcaption>
                            {{ image.title|ellipsistrim:60 }}
                            <span class="visuallyhidden">{{ image.width }} {{ translated_pixels  }} &#215; {{ image.height }} {{ translated_pixels}}</span>
                        </figcaption>
                    </figure>
                    <p class="col12">
                        <input type="checkbox" name="select_image" value="{{ image.id }}" class="toggle-select-row"/>
                    </p>
                </a>
            </li>
        {% endfor %}
    </ul>

    {% include "wagtailadmin/shared/pagination_nav.html" with items=images %}

{% else %}
    {% if is_searching %}
        <h2>{% blocktrans %}Sorry, no images match "<em>{{ query_string }}</em>"{% endblocktrans %}</h2>

        {% search_other %}
    {% else %}
        {% url 'wagtailimages:add_multiple' as wagtailimages_add_image_url %}
        {% if current_collection %}
            <p>{% blocktrans %}You haven't uploaded any images in this collection. Why not <a href="{{ wagtailimages_add_image_url }}">upload one now</a>?{% endblocktrans %}</p>
        {% else %}
            <p>{% blocktrans %}You haven't uploaded any images. Why not <a href="{{ wagtailimages_add_image_url }}">upload one now</a>?{% endblocktrans %}</p>
        {% endif %}
    {% endif %}
{% endif %}
